home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmSequen
- Caption = "The Sequen Program"
- ClientHeight = 5940
- ClientLeft = 1110
- ClientTop = 735
- ClientWidth = 7350
- Height = 6345
- Icon = SEQUEN.FRX:0000
- Left = 1050
- LinkTopic = "Form1"
- Picture = SEQUEN.FRX:0302
- ScaleHeight = 5940
- ScaleWidth = 7350
- Top = 390
- Width = 7470
- Begin CheckBox chkWriteProtect
- BackColor = &H000000FF&
- Caption = "Check1"
- Height = 195
- Left = 5040
- TabIndex = 5
- Top = 4080
- Value = 1 'Checked
- Width = 255
- End
- Begin CommonDialog CMDialog1
- CancelError = -1 'True
- Left = 5640
- Top = 360
- End
- Begin CommandButton cmdNew
- Caption = "&New..."
- Height = 495
- Left = 360
- TabIndex = 2
- Top = 2520
- Width = 1215
- End
- Begin CommandButton cmdOpen
- Caption = "&Open..."
- Height = 495
- Left = 360
- TabIndex = 3
- Top = 1920
- Width = 1215
- End
- Begin CommandButton cmdWrite
- Caption = "&Write"
- Enabled = 0 'False
- Height = 975
- Left = 5640
- TabIndex = 4
- Top = 1800
- Width = 1215
- End
- Begin TextBox txtFile
- Height = 1335
- Left = 360
- MultiLine = -1 'True
- ScrollBars = 3 'Both
- TabIndex = 1
- Top = 4560
- Width = 6735
- End
- Begin CommandButton cmdExit
- Caption = "E&xit"
- Height = 495
- Left = 360
- TabIndex = 0
- Top = 3120
- Width = 1215
- End
- Option Explicit
- Const IDNO = 7
- Sub cmdExit_Click ()
- End
- End Sub
- Sub cmdNew_Click ()
- Dim Answer
- Dim FileNum
- Dim OriginalFileName
- ' Set an error trap to detect if
- ' the user clicked the Cancel button
- ' of the Save As dialog box.
- On Error GoTo SaveAsError
- ' Fill the items of the File Type list box of
- ' the Save As dialog box.
- CMDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"
- ' Set the default File Type to *.txt
- CMDialog1.FilterIndex = 1
- ' Display the Save As dialog box
- OriginalFileName = CMDialog1.Filename
- CMDialog1.Action = 2
- On Error GoTo 0
- If Dir(CMDialog1.Filename) <> "" Then
-
- Answer = MsgBox(CMDialog1.Filename + Chr$(13) + "File exists already. Overwrite it?", 4)
-
- If Answer = IDNO Then
- CMDialog1.Filename = OriginalFileName
- Exit Sub
- End If
- End If
- ' Get a free file number
- FileNum = FreeFile
- Open CMDialog1.Filename For Output As FileNum
- Write #FileNum, "SEQUEN HEADER", ""
- Close FileNum
- frmSequen.Caption = "SEQUEN - " + CMDialog1.Filetitle
- txtFile.Text = ""
- cmdWrite.Enabled = True
- ' Exit the procedure
- Exit Sub
- SaveAsError:
- Exit Sub
- End Sub
- Sub cmdOpen_Click ()
- Dim Header
- Dim FileNum
- Dim ReadData
- Dim OriginalFileName
- ' Set an error trap to detect if
- ' the user clicked the Cancel button
- ' of the Open dialog box.
- On Error GoTo OpenError
- ' Fill the items of the File Type list box of
- ' the Open dialog box.
- CMDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"
- ' Set the default File Type to *.txt
- CMDialog1.FilterIndex = 1
- ' Display the Open dialog box
- OriginalFileName = CMDialog1.Filename
- CMDialog1.Action = 1
- On Error GoTo 0
- If Dir(CMDialog1.Filename) = "" Then
-
- MsgBox CMDialog1.Filename + Chr$(13) + "File does not exist.", 0
-
- CMDialog1.Filename = OriginalFileName
- Exit Sub
- End If
- FileNum = FreeFile
- Open CMDialog1.Filename For Input As FileNum
- If FileLen(CMDialog1.Filename) > 0 Then
- Input #FileNum, Header
- End If
- If Header <> "SEQUEN HEADER" Then
- MsgBox CMDialog1.Filename + " is not a SEQUEN file!", 48
- CMDialog1.Filename = OriginalFileName
- Else
- frmSequen.Caption = "SEQUEN - " + CMDialog1.Filetitle
- cmdWrite.Enabled = True
- Input #FileNum, ReadData
- txtFile.Text = ReadData
- End If
- Close FileNum
- ' Exit the procedure
- Exit Sub
- OpenError:
- Exit Sub
- End Sub
- Sub cmdWrite_Click ()
- Dim FileNum
- If chkWriteProtect.Value = 0 Then
-
- MsgBox "Place an X inside the write protect check box!"
- Exit Sub
- End If
- FileNum = FreeFile
- Open CMDialog1.Filename For Output As FileNum
- Write #FileNum, "SEQUEN HEADER", txtFile.Text
-
- Close FileNum
- End Sub
-